/*
 * @Author: Neil 1294641898@qq.com
 * @Date: 2022-09-04 21:43:58
 * @LastEditors: Neil 1294641898@qq.com
 * @LastEditTime: 2022-09-05 20:29:43
 * @FilePath: \stupid_home\src\router\index.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import Vue from 'vue'
import Router from 'vue-router'


Vue.use(Router)
const routes = [
    {
        path: '/',
        redirect:"/login"
    },
    {
        path: '/login',
        name: 'login',
        component: () => import("../views/login"),
    }, {
        path: '/register',
        name: 'register',
        component: () => import("../views/register"),
    }, {
        path: '/group',
        name: "group",
        component: () => import("../views/group"),
        meta: { keepAlive: true }
    }, {
        path: '/device',
        name: "device",
        component: () => import("../views/device")
    }, {
        path: '/communication',
        name: "communication",
        component: () => import("../views/communication")
    }
]
// 尝试使用hash编码去掉地址栏的'#',函数比着强哥抄的
const createRouter = () => new Router({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})
const router = createRouter()
export function resetRouter() {
    const newRouter = createRouter()
    router.matcher = newRouter.matcher
}

export default router
